/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2023-10-20 10:32:43
 * @LastEditors: TT
 * @LastEditTime: 2023-10-30 15:46:20
 */

import 'dart:convert';

class UsermodelStrId {
  static String uId = 'uId';
  static String nickName = 'nickName';
  static String headImage = 'headImage';
  static String pwd = 'pwd';
  static String account = 'account';
  static String devil = "devil";
  static String openDevil = "openDevil";
  static String changeTapNum = "changeTapnum";
  static String profiles = "profiles";
  static String isShowAge = 'isShowAge';
  static String isShowSex = 'isShowSex';
  static String sex = "sex";
  static String age = 'age';
  static String status = 'status';
}

class UserModel {
  UserModel({
    this.uId,
    this.nickName,
    this.headImage,
    this.pwd,
    this.account,
    this.profiles,
    this.sex = 0,
    this.birthday,
    this.isShowAge = 0,
    this.isShowSex = 0,
    this.isDevil = 0,
    this.changeTapNum = 0,
    this.isOpenChangeDevil = 0,
    this.status = 0,
  });

  UserModel copyWith({
    /// 用户ID
    int? uId,

    /// 用户昵称
    String? nickName,

    /// 头像
    String? headImage,

    /// 密码
    String? pwd,

    /// 帐号
    String? account,

    /// 简介
    String? profiles,

    /// 是否打开 切换 恶魔世界 0 未打开 1 打开
    int? isOpenChangeDevil,

    /// 切换方式 0 双击屏幕切换 1 长按切换
    int? changeTapNum,

    /// 是否 是 恶魔世界 0 正常 1 恶魔
    int? isDevil,

    /// 是否显示 性别 0 不显示 1 显示
    int? isShowSex,

    /// 是否显示 年龄 0 不显示 1 显示
    int? isShowAge,

    /// 性别 0 男 1 女
    int? sex,

    /// 生日 日期
    String? birthday,

    /// 中图
    String? thumBImage,

    /// 小图
    String? minImage,
    int? status,
  }) =>
      UserModel(
        uId: uId ?? this.uId,
        nickName: nickName ?? this.nickName,
        headImage: headImage ?? this.headImage,
        pwd: pwd ?? this.pwd,
        account: account ?? this.account,
        profiles: profiles ?? this.profiles,
        isDevil: isDevil ?? this.isDevil,
        isOpenChangeDevil: isOpenChangeDevil ?? this.isOpenChangeDevil,
        changeTapNum: changeTapNum ?? this.changeTapNum,
        sex: sex ?? this.sex,
        birthday: birthday ?? this.birthday,
        isShowAge: isShowAge ?? this.isShowAge,
        isShowSex: isShowSex ?? this.isShowSex,
        status: status ?? this.status,
      );

  /// 用户ID
  int? uId;

  /// 用户昵称
  String? nickName;

  /// 头像
  String? headImage;

  /// 密码
  String? pwd;

  /// 帐号
  String? account;

  /// 简介
  String? profiles;

  /// 是否打开 切换 恶魔世界 0 未打开 1 打开
  int? isOpenChangeDevil;

  /// 切换方式 0 双击屏幕切换 1 长按切换
  int? changeTapNum;

  /// 是否 是 恶魔世界 0 正常 1 恶魔
  int? isDevil;

  /// 是否显示 性别 0 不显示 1 显示
  int? isShowSex;

  /// 是否显示 年龄 0 不显示 1 显示
  int? isShowAge;

  /// 性别 0 男 1 女
  int sex;

  /// 生日 日期
  String? birthday;

  /// 账号状态 0 退出登录 1 登录
  int? status;
  factory UserModel.fromJson(String str) => UserModel.fromMap(
        json.decode(
          str,
        ),
      );

  String toJson() => json.encode(
        toMap(),
      );

  factory UserModel.fromMap(Map<dynamic, dynamic> json) => UserModel(
        uId: json[UsermodelStrId.uId],
        nickName: json[UsermodelStrId.nickName] ?? "昵称",
        headImage: json[UsermodelStrId.headImage],
        pwd: json[UsermodelStrId.pwd],
        account: json[UsermodelStrId.account],
        profiles: json[UsermodelStrId.profiles],
        isOpenChangeDevil: json[UsermodelStrId.openDevil] ?? 0,
        isDevil: json[UsermodelStrId.devil] ?? 0,
        changeTapNum: json[UsermodelStrId.changeTapNum] ?? 0,
        isShowAge: json[UsermodelStrId.isShowAge] ?? 0,
        isShowSex: json[UsermodelStrId.isShowSex] ?? 0,
        sex: json[UsermodelStrId.sex] ?? 0,
        birthday: json[UsermodelStrId.age],
        status: json[UsermodelStrId.status],
      );

  Map<String, dynamic> toMap() => {
        UsermodelStrId.uId: uId,
        UsermodelStrId.nickName: nickName ?? "昵称",
        UsermodelStrId.headImage: headImage,
        UsermodelStrId.pwd: pwd,
        UsermodelStrId.account: account,
        UsermodelStrId.openDevil: isOpenChangeDevil,
        UsermodelStrId.devil: isDevil,
        UsermodelStrId.changeTapNum: changeTapNum,
        UsermodelStrId.profiles: profiles,
        UsermodelStrId.age: birthday,
        UsermodelStrId.sex: sex,
        UsermodelStrId.isShowAge: isShowAge,
        UsermodelStrId.isShowSex: isShowSex,
        UsermodelStrId.status: status,
      
      };
}
